﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Add.aspx.cs" Inherits="fsw.Web.Project.Add" ValidateRequest="false" %>
<%@ Register Src="~/HeaderJs.ascx" TagPrefix="uc1" TagName="HeaderJs" %>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge" />
    <meta name="renderer" content="webkit" />
    <title>添加项目</title>
    <uc1:HeaderJs runat="server" ID="HeaderJs" />
</head>
<body>
   <div class="position">当前位置：项目管理  > <a href="List.aspx">项目管理</a>> <a href="Add.aspx">项目添加</a></div>
    <div class="border">
        <legend>添加项目</legend>
        <form id="form1" class="am-form am-form-horizontal" runat="server">
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">项目名称</label>
                <div class="am-u-sm-10">
                    <input type="text" name="HosName" size="50" maxlength="50" placeholder="请输入项目名称"  data-rule="项目名称:required;" />
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">项目ID</label>
                <div class="am-u-sm-10">
                    <input type="text" name="Pid" size="50" maxlength="50"  placeholder="请输入项目ID" data-rule="项目ID:required;" />
                </div>
            </div>            
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">排序</label>
                <div class="am-u-sm-10">
                    <input type="text" name="OrderNo" size="30" />
                    <span class="am-margin-left input-tips">数字越大越靠前</span>
                </div>
            </div>
            <div class="am-form-group">
                <label class="am-u-sm-2 am-form-label">备注</label>
                <div class="am-u-sm-10">
                    <textarea name="Remarks" rows="4" cols="50"></textarea>
                   
                </div>
            </div>
            <div class="am-form-group">
                <div class="am-u-sm-10 am-u-sm-offset-2">
                    <button type="submit" class="am-btn am-btn-primary am-radius">添加</button>
                    <button type="button" class="am-btn am-radius am-back">返回</button>
                </div>
            </div>
        </form>
    </div>
    <script>
        $(function () {
            toastr.options = { "positionClass": "toast-bottom-center", "timeOut": "3000", "onclick": null, showMethod: "slideDown", hideMethod: "slideUp" };
            $('.am-form').validator({
                timely: 2,
                stopOnError: true,
                focusCleanup: true,
                ignore: ':hidden',
                theme: 'yellow_right_effect',
                msgMaker: function (opt) { if (opt.type == 'error') { toastr.clear(); toastr.error(opt.msg); } },
                valid: function (form) {
                    $.AMUI.progress.inc();
                    $.ajax({
                        type: 'post',
                        cache: false,
                        dataType: 'json',
                        url: 'Add.aspx',
                        data: $(form).serialize(),
                        error: function (e) { alert(e.responseText); },
                        success: function (d) {
                            $.AMUI.progress.set(1.0);
                            if (d.state == 'success') {
                                toastr.success(d.msg);
                                setTimeout(function () { location.href = 'List.aspx'; }, 1500);
                            }
                            else {
                                toastr.error(d.msg);
                            }

                        }
                    })
                }
            });

        })
    </script>
</body>
</html>
